﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace WebApplication4
{

    public partial class Default : System.Web.UI.Page
    {
        static public int j = 0;

        protected void Page_Load(object sender, EventArgs e)
        {


        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {


        }

        protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {



            for (int i = 0; i < GridView1.Rows.Count; i++)
            {

                GridViewRow row = GridView1.Rows[i];
                bool isChecked = ((CheckBox)row.FindControl("select")).Checked;
                TextBox text = (TextBox)row.FindControl("txtQuantity");
                if (isChecked)
                {
                    string id = GridView1.Rows[i].Cells[0].Text;
                    string name = GridView1.Rows[i].Cells[1].Text;
                    string brand = GridView1.Rows[i].Cells[2].Text;
                    string category = GridView1.Rows[i].Cells[3].Text;
                    string price = GridView1.Rows[i].Cells[4].Text;
               
       

                    Session["id" + j] = id;
                    Session["name" + j] = name;
                    Session["brand" + j] = brand;
                    Session["category" + j] = category;
                    Session["price" + j] = price;
                    Session["quantity" + j] = text.Text;
                   
             

                    j++;
                    Label1.Text = "Your item(s) has been added to the cart";

                }


            }
        }
    }
}